package com.yyjj.my.activity;

import android.graphics.Color;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.aries.ui.view.title.TitleBarView;
import com.avos.avoscloud.AVException;
import com.avos.avoscloud.AVObject;
import com.avos.avoscloud.AVUser;
import com.avos.avoscloud.SaveCallback;
import com.yyjj.my.R;
import com.yyjj.my.db.AVDbManager;

import tech.com.commoncore.base.BaseTitleActivity;
import tech.com.commoncore.utils.DataUtils;
import tech.com.commoncore.utils.NetworkUtils;
import tech.com.commoncore.utils.ToastUtil;

/**
 * Desc:
 */
@Route(path = "/my/feedback")
public class FeedBackActivity extends BaseTitleActivity {
    EditText etFeedback;
    @Override
    public int getContentLayout() {
        return R.layout.my_activity_feedback;
    }

    @Override
    public void initView(Bundle savedInstanceState) {
         etFeedback = findViewById(R.id.et_feedback);

         findViewById(R.id.btn_submit).setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 doSubmit();
             }
         });
    }

    @Override
    public void setTitleBar(TitleBarView titleBar) {
        titleBar.setTitleMainText(getResources().getString(R.string.feedback)).setTextColor(Color.WHITE);
    }
    private void doSubmit() {

        String content = etFeedback.getText().toString();

        if (TextUtils.isEmpty(content)) {
            ToastUtil.show(R.string.my_tip_empty_feedback);
            return;
        }

        if (!NetworkUtils.isNetworkConnected()) {
            ToastUtil.show(R.string.my_tip_feedback_fail);
        } else {
            ToastUtil.show(R.string.my_tip_feedback_success);
            finish();
        }

    }
}
